LanguageManager
The LanguageManager manages what language to use for all the graphical parts of the mod. Because it only cares about graphical parts of the mod, Any addon developer can use any language. Such as Dutch!
You can even use languages that don't exist, Just note that it only supports the characters that the font's in Scrap Mechanic Allow.
Functions
getLanguages
sm.scrapcomputers.languageManager.getLanguages()
Gets all loaded languages and returns them
getTotalLanguages
sm.scrapcomputers.languageManager.getTotalLanguages()
Gets the total loaded languages and returns the amount
Returns:
- [ integer ] The total amount of loaded languages
reloadLanguages
sm.scrapcomputers.languageManager.reloadLanguages()
Reloads all languages
addLanguage
sm.scrapcomputers.languageManager.addLanguage( localid, name )
Adds a language to the language manager
Arguments:
- localid [ string ] The local id of your mod/addon
- name [ string ] The name of the language
Returns:
- [ boolean ] If it has succeeded or not. Only fails if it failed to load the file or failed to parse the contents of the translation file.
autoDetectLanguage
sm.scrapcomputers.languageManager.autoDetectLanguage()
Automaticly detects a language, If there is no translation for it, it would default to English
setSelectedLanguage
sm.scrapcomputers.languageManager.setSelectedLanguage( language )
Sets the selected language to whatever you specify, Wil error if it cant find one.
Arguments:
- langugage [ string ] The language to select
getSelectedLanguage
sm.scrapcomputers.languageManager.getSelectedLanguage()
Gets the current selected language.
Returns:
- [ string ] The selected language
translatable
sm.scrapcomputers.languageManager.translatable( text, ... )
Translates text
Arguments:
- text [ string ] The text to translate
- ... [ any|any[] ] The parameters of the translated text
Returns:
- [ string ] The translated text